package com.evl.core.filter;

import java.io.IOException;

import javax.servlet.FilterChain;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.springframework.context.annotation.Configuration;
import org.springframework.web.filter.OncePerRequestFilter;

@Configuration
public class CrossFilter extends OncePerRequestFilter {

    @Override
    protected void doFilterInternal(HttpServletRequest request, HttpServletResponse response, FilterChain filterChain) throws ServletException, IOException {

    	response.addHeader("Access-Control-Allow-Origin","*");

        response.addHeader("Access-Control-Allow-Methods","POST, GET, OPTIONS,DELETE,PUT");
        response.addHeader("Access-Control-Max-Age","100");

        response.addHeader("Access-Control-Allow-Headers", "x-requested-with,Content-Type,authorizationId");
        response.addHeader("Access-Control-Allow-Credentials","false");
        filterChain.doFilter(request, response);
    }
    



}